//
//  YHMarcros.h
//  YSSmartHome
//
//  Created by yanghao on 2017/1/9.
//  Copyright © 2017年 yahaong. All rights reserved.
//

#ifndef YHMarcros_h
#define YHMarcros_h

#define BIT_SET(a,b) ((a) |= (1<<(b)))
#define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
#define BIT_FLIP(a,b) ((a) ^= (1<<(b)))
#define BIT_CHECK(a,b) ((a) & (1<<(b)))


#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS
#import"Masonry.h"

// 尺寸
#define kScreenSize      [UIScreen mainScreen].bounds.size
#define kScreenWidth     [UIScreen mainScreen].bounds.size.width
#define kScreenHeight    [UIScreen mainScreen].bounds.size.height

#define DEV_BEGIN   1
#define DEV_END     10
#define DEV_NUM_MAX 20
#define DEV_CHANNEL_MAX 16
#define Device_Cell_Width ([[UIScreen mainScreen]bounds].size.width)
#define Device_Cell_Separate 40
#define Device_Cell_Height (Device_Cell_Width*9/16+Device_Cell_Separate)
#define kGAP 10
#define kAvatar_Size 40


/**
 *  调用 KIphoneSize_Widith(100) 6的宽度 会根据456给出不同宽度，
 高度同上
 *  @param iphone6p 100*1.104
 *  @param iphone6  100
 *  @param iphone5s 100*0.853
 *  @param iphone4s 100*0.853
 *  @return
 */
//适配宏 根据屏幕尺寸来判断当前手机型号

#define IsIphone6P kScreenSize.width==414
#define IsIphone6 kScreenSize.width==375
#define IsIphone5S kScreenSize.height==568
//456字体大小  KIOS_Iphone456(iphone6p,iphone6,iphone5s,iphone4s)
#define kIOS_Iphone456(iphone6p,iphone6,iphone5s,iphone4s) (IsIphone6P?iphone6p:(IsIphone6?iphone6:(IsIphone5S?iphone5s:iphone4s)))
//宽  KIphoneSize_Widith(iphone6)  高 KIphoneSize_Height(iphone6)
#define kIphoneSize_Widith(iphone6)  (IsIphone6P?1.104*iphone6:(IsIphone6?iphone6:(IsIphone5S?0.853*iphone6:0.853*iphone6)))
#define kIphoneSize_Height(iphone6)  (IsIphone6P?1.103*iphone6:(IsIphone6?iphone6:(IsIphone5S?0.851*iphone6:0.720*iphone6)))

/** 获取系统版本 */
#define iOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue])
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])

/** 是否为iOS6 */
#define iOS6 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) ? YES : NO)

/** 是否为iOS7 */
#define iOS7 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) ? YES : NO)

/** 是否为iOS8 */
#define iOS8 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) ? YES : NO)

/** 是否为iOS9 */
#define iOS9 (([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) ? YES : NO)

//Log

#ifdef DEBUG
#define debugLogInfo(format, ...) NSLog((@"[函数名:%s]" "[行号:%d]" format), __FUNCTION__, __LINE__, ##__VA_ARGS__);

#define debugMethod() NSLog(@"%s", __func__)
#else
#define debugLogInfo(...)
#define debugMethod()
#endif

//颜色
#define RGBAColor(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define RGBColor(r,g,b) RGBAColor(r,g,b,1.0)
#define UIColorFromHex(s) RGBAColor(((s & 0xFF0000) >> 16), ((s &0xFF00) >>8), (s &0xFF), ((s & 0xFF000000) >> 24))
#define kRandomColor RGBColor( arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

#define kBgColor RGBColor(241, 241, 241)
#define kSplitLineColor RGBColor(233, 233, 233)
#define kGlobalRedColor RGBColor(239, 75, 58)


#endif /* YHMarcros_h */
